
<script type="text/javascript">
    <!--
    $(function(){
        _task_candidate_users_list=$('#task-candidate-users-list').datagrid({
            title:"处理人",
            singleSelect:true,
            height:450,
            rownumbers:true,
            striped:true,
            toolbar:[{
                text:'Add',
                iconCls:'icon-add',
                handler:function(){
                    _task_candidate_win.window('open');
                    _task_candidate_win.window('setTitle','处理人');
                    _task_candidate_win.window('refresh','addCandidateUser.html');
                }
            }]
        });
        _task_candidate_win = $('#task-candidate-win').window({
            //href:'${ctx}/wf/procdef/procdef!forTaskListenerConfig.action',
            closed:true,
            //cache:false,
            draggable:false,
            collapsible:false,
            minimizable:false,
            maximizable:false,
            modal:true,
            shadow:true
        });
        loadTaskCandidateUsers();
    });
    function candidateUsersBtFormatter(value,rowData,rowIndex){
        var userId = rowData.userId;
        var d = '<img onclick="deleteCandidateUser(\''+userId+'\')" src="image/delete.gif" title="'+"删除"+'" style="cursor:hand;"/>';
        return d;
    }
    function deleteCandidateUser(userId){
        task.deleteCandidateUser(userId);
        loadTaskCandidateUsers();
    }
    function loadTaskCandidateUsers(){
        var candidateUsers = task.candidateUsers;
        var candidate_users_grid_rows=[];
        //alert(listeners.getSize());
        for(var i=0;i<candidateUsers.getSize();i++){
            var candidateUser = candidateUsers.get(i);
            var user = {
                userId:candidateUser.userId,
                name:candidateUser.name,
                roleName:candidateUser.roleName,
                action:''
            };
            candidate_users_grid_rows[i]=user;
        };
        //alert(listener_grid_rows);
        var candidate_users_grid_data={
            total:candidateUsers.getSize(),
            rows:candidate_users_grid_rows
        };
        _task_candidate_users_list.datagrid('loadData',candidate_users_grid_data);
    }
    //-->
</script>
<!--<div id="task-candidate-users-panel">-->
<table id="task-candidate-users-list" name="task-candidate-users-list">
    <thead>
    <tr>
        <th field="userId" hidden='true'></th>
        <th field="name" width="100" align="middle" sortable="false">姓名</th>
        <th field="roleName" width="100" align="middle" sortable="false">角色</th>
        <th field="action" width="80" align="center" formatter="candidateUsersBtFormatter">操作</th>
    </tr>
    </thead>
</table>
<!--</div>-->